import { createStore } from 'vuex';
import { useCounter } from '@/mixins/userHooks.js';
const { getUserInfo, userInfo, tool } = useCounter();
const store = createStore({
  state() {
    return {
      // 用户信息
      userInfo: {},
      isLogin: false,
      share_id: '', //分享ID
    };
  },
  mutations: {
    // 设置分享ID
    setShareId(state, params) {
      state.share_id = params;
    },
    // 设置用户信息
    setUserInfo(state, params) {
      console.log('设置了', params);
      state.userInfo = params;
      tool.storage('userInfo', params);
    },
    // 设置用户信息
    setLogin(state, params) {
      state.isLogin = params;
    },
  },
  actions: {},
  getters: {},
});

export default store;
